﻿<%@ Control Language="C#" %>

<%@ Import Namespace="Ext.Net" %>
<%@ Import Namespace="System.Xml.Linq" %>
<%@ Import Namespace="Buffalo.Web.Areas.Tourism" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        GenerateMenu();
        GeneralVar.gLanguageHelper.ApplyLanguage(this.accWestMenu, CommonManager.GetCurrentCulture(), true);
    }
    private void GenerateMenu()
    {
        string menuFile = string.Format("{0}/{1}", CommonManager.GetPhysicalAppPath(), "Areas/Tourism/Views/Catalog/CatalogMenuSchema.xml");
        XDocument xmlDocument = XDocument.Load(menuFile);

        List<XElement> listElement = xmlDocument.Elements("MenuPanels").Elements("MenuPanel").Elements("MenuItem").ToList();
        foreach (XElement element in listElement)
        {
            Ext.Net.MenuItem menuItem = new Ext.Net.MenuItem(GeneralVar.gLanguageHelper.GetLocalizeString(element.Element("Title").Value));
            menuItem.Icon = Icon.ApplicationForm;
            menuItem.CustomConfig.Add(new ConfigItem("Url", element.Element("Url").Value, ParameterMode.Value));
            mnpCatalog.Menu.Items.Add(menuItem);
        }
    }
</script>

<ext:AccordionLayout ID="accWestMenu" runat="server" Animate="true">
    <Items>
        <ext:MenuPanel 
            ID="mnpTourProgram" 
            runat="server" 
            Collapsed="true" 
            Title="TourProgram"
            Border="false" 
            SaveSelection="false" 
            Cls="white-menu">
            <Menu ID="mnuTourProgram" runat="server">
                <Items>
                    <ext:MenuItem ID="mniTourInfo" runat="server" Text="TourList" Icon="ApplicationForm">
                        <CustomConfig>
                            <ext:ConfigItem Name="url" Value="/Tourism/TourProgram/TourList/" Mode="Value" />
                        </CustomConfig>
                    </ext:MenuItem>

                </Items>
                <Listeners>
                    <ItemClick Handler="AppGeneral.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls });" />
                </Listeners>
            </Menu>
        </ext:MenuPanel>
        <ext:MenuPanel 
            ID="mnpTourGuide" 
            runat="server" 
            Collapsed="true" 
            Title="TourGuide"
            Border="false" 
            SaveSelection="false" 
            Cls="white-menu">
            <Menu ID="Menu1" runat="server">
                <Items>
                    <ext:MenuItem ID="mniTourGuide" runat="server" Text="TourGuide" Icon="ApplicationForm">
                        <CustomConfig>
                            <ext:ConfigItem Name="url" Value="/Tourism/TourGuide/TourGuideList/" Mode="Value" />
                        </CustomConfig>
                    </ext:MenuItem>

                </Items>
                <Listeners>
                    <ItemClick Handler="AppGeneral.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls });" />
                </Listeners>
            </Menu>
        </ext:MenuPanel>

        <ext:MenuPanel 
            ID="mnpReport" 
            runat="server" 
            Collapsed="true" 
            Title="Report"
            Border="false" 
            SaveSelection="false" 
            Cls="white-menu">
            <Menu ID="Menu2" runat="server">
                <Items>
                    <ext:MenuItem ID="mniDetailReport" runat="server" Text="DetailReport" Icon="ApplicationForm">
                        <CustomConfig>
                            <ext:ConfigItem Name="url" Value="/Tourism/Report/DetailReport/" Mode="Value" />
                        </CustomConfig>
                    </ext:MenuItem>
                </Items>
                <Items>
                    <ext:MenuItem ID="mniStatisticReport" runat="server" Text="StatisticReport" Icon="ApplicationForm">
                        <CustomConfig>
                            <ext:ConfigItem Name="url" Value="/Tourism/Report/StatisticReport/" Mode="Value" />
                        </CustomConfig>
                    </ext:MenuItem>
                </Items>
                <Items>
                    <ext:MenuItem ID="mniGuestReport" runat="server" Text="GuestReport" Icon="ApplicationForm">
                        <CustomConfig>
                            <ext:ConfigItem Name="url" Value="/Tourism/Report/GuestReport/" Mode="Value" />
                        </CustomConfig>
                    </ext:MenuItem>
                </Items>
                <Items>
                    <ext:MenuItem ID="mniFeedbackReport" runat="server" Text="FeedbackReport" Icon="ApplicationForm">
                        <CustomConfig>
                            <ext:ConfigItem Name="url" Value="/Tourism/Report/FeedbackReport/" Mode="Value" />
                        </CustomConfig>
                    </ext:MenuItem>
                </Items>
                <Listeners>
                    <ItemClick Handler="AppGeneral.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls });" />
                </Listeners>
            </Menu>
        </ext:MenuPanel>
        <ext:MenuPanel ID="mnpCatalog" runat="server" Collapsed="true" Title="Catalog" Border="false"
            SaveSelection="false" Cls="white-menu">
            <Menu ID="mnuCatalog" runat="server">
                <Listeners>
                    <ItemClick Handler="AppGeneral.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls });" />
                </Listeners>
            </Menu>
        </ext:MenuPanel>

    </Items>
</ext:AccordionLayout>
